package services

import (
	"gitee.com/daonna/video-copyright-blockchain/internal/blockchain"
)

type VideoService struct {
	Blockchain *blockchain.Blockchain
}

func NewVideoService() *VideoService {
	return &VideoService{
		Blockchain: blockchain.NewBlockchain(),
	}
}

func (vs *VideoService) AddVideoHash(hash string) error {
	vs.Blockchain.AddBlock(hash)
	return nil
}

func (vs *VideoService) VerifyVideoHash(hash string) bool {
	for _, block := range vs.Blockchain.Blocks {
		if block.Data == hash {
			return true
		}
	}
	return false
}
